package com.bw.goods_module.home.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.blankj.utilcode.util.ConvertUtils;
import com.bw.goods_module.R;
import com.youth.banner.adapter.BannerAdapter;

import java.util.List;

public class TextBannerAdapter extends BannerAdapter<String, TextBannerAdapter.TextBannerViewHolder> {

    public TextBannerAdapter(List<String> datas) {
        super(datas);
    }

    @Override
    public TextBannerViewHolder onCreateHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home_txt,parent,false);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        view.setLayoutParams(params);
        return new TextBannerViewHolder(view);
    }

    @Override
    public void onBindView(TextBannerViewHolder holder, String data, int position, int size) {
        holder.title.setText(data);
    }

    class TextBannerViewHolder extends RecyclerView.ViewHolder{
        TextView title;
        public TextBannerViewHolder(@NonNull View itemView) {
            super(itemView);
            title = itemView.findViewById(R.id.home_txt_title);
        }
    }

}
